<ui:composition  xmlns="http://www.w3.org/1999/xhtml"
                 xmlns:h="http://java.sun.com/jsf/html"
                 xmlns:f="http://java.sun.com/jsf/core"
                 xmlns:ui="http://java.sun.com/jsf/facelets"
                 xmlns:p="http://primefaces.org/ui"
                 xmlns:x="http://xpert.com/faces">
    
  
    <h:form id="formCreatePerson" >
        <p:fieldset legend="#{xmsg['generalData']}">
            <x:modalMessages/>

            <div class="container-fluid">
                 <div class="row">
                      <div class="form-group col-lg-4 col-md-6 col-sm-6 col-xs-12">
                         <h:outputLabel for="code" value="* #{msg['person.code']}:" />
                         <p:inputMask id="code" mask="9?999999999" placeHolder="" value="#{personMB.entity.code}" styleClass="form-control" />
                     </div>
                      <div class="form-group col-lg-4 col-md-6 col-sm-6 col-xs-12">
                         <h:outputLabel for="name" value="* #{msg['person.name']}:" />
                         <p:inputText id="name" value="#{personMB.entity.name}" maxlength="255"  styleClass="form-control"  />
                     </div>
                      <div class="form-group col-lg-4 col-md-6 col-sm-6 col-xs-12">
                         <h:outputLabel for="email" value="#{msg['person.email']}:" />
                         <p:inputText id="email" value="#{personMB.entity.email}" maxlength="255"  styleClass="form-control"  />
                     </div>
                      <div class="form-group col-lg-4 col-md-6 col-sm-6 col-xs-12">
                         <h:outputLabel for="salary:input" value="#{msg['person.salary']}:" />
                         <x:inputNumber id="salary" value="#{personMB.entity.salary}" styleClass="form-control"/>
                     </div>
                      <div class="form-group col-lg-4 col-md-6 col-sm-6 col-xs-12">
                         <h:outputLabel for="cpf" value="* #{msg['person.cpf']}:" />
                         <p:inputText id="cpf" value="#{personMB.entity.cpf}" maxlength="255"  styleClass="form-control"  />
                     </div>
                      <div class="form-group col-lg-4 col-md-6 col-sm-6 col-xs-12">
                         <h:outputLabel for="birthday" value="* #{msg['person.birthday']}:" />
                         <p:calendar id="birthday" value="#{personMB.entity.birthday}" 
                                     showOn="button" pattern="dd/MM/yyyy" styleClass="uix-calendar"  >
                             <x:mask/>
                         </p:calendar>
                     </div>
                      <div class="form-group col-lg-4 col-md-6 col-sm-6 col-xs-12">
                         <h:outputLabel for="rg" value="* #{msg['person.rg']}:" />
                         <p:inputText id="rg" value="#{personMB.entity.rg}" maxlength="10"  styleClass="form-control"  />
                     </div>
                      <div class="form-group col-lg-4 col-md-6 col-sm-6 col-xs-12">
                         <h:outputLabel for="status" value="* #{msg['person.status']}:" />
                         <h:selectOneMenu id="status" value="#{personMB.entity.status}"  styleClass="form-control" >
                             <f:selectItem itemLabel="#{xmsg['select']}" />
                             <f:selectItems value="#{findAllBean.get(classMB.status)}" 
                                            var="status"
                                            itemLabel="#{status}"/>
                         </h:selectOneMenu>
                     </div>
                      <div class="form-group col-lg-4 col-md-6 col-sm-6 col-xs-12">
                         <h:outputLabel for="group" value="* #{msg['person.group']}:" />
                         <h:selectOneMenu id="group" value="#{personMB.entity.group}" converter="entityConverter" styleClass="form-control" >
                             <x:initializer/>
                             <f:selectItem itemLabel="#{xmsg['select']}" />
                             <f:selectItems value="#{findAllBean.get(classMB.group)}" 
                                            var="group"
                                            itemLabel="#{group}"/>
                         </h:selectOneMenu>
                     </div>
                      <div class="form-group col-lg-4 col-md-6 col-sm-6 col-xs-12">
                         <h:outputLabel for="group2" value="* #{msg['person.group2']}:" />
                         <h:selectOneMenu id="group2" value="#{personMB.entity.group2}" converter="entityConverter" styleClass="form-control" >
                             <x:initializer/>
                             <f:selectItem itemLabel="#{xmsg['select']}" />
                             <f:selectItems value="#{findAllBean.get(classMB.group)}" 
                                            var="group"
                                            itemLabel="#{group}"/>
                         </h:selectOneMenu>
                     </div>
                      <div class="form-group col-lg-4 col-md-6 col-sm-6 col-xs-12">
                         <div class="checkbox">
                             <label>
                                 <h:selectBooleanCheckbox id="active" value="#{personMB.entity.active}" />
                                 #{msg['person.active']}
                             </label>
                         </div>
                     </div>
                      <div class="form-group col-lg-4 col-md-6 col-sm-6 col-xs-12">
                         <h:outputLabel value="#{msg['person.permissions']}:" />
                         <h:selectManyCheckbox id="permissions" value="#{personMB.entity.permissions}" converter="entityConverter" >
                             <x:initializer/>
                             <f:selectItems value="#{findAllBean.get(classMB.permission)}" 
                                            var="permission"
                                            itemLabel="#{permission}"/>
                         </h:selectManyCheckbox>
                     </div>

                 </div>
             </div>
        </p:fieldset>
        <h:outputText value="#{xmsg['requiredFieldsForm']}"/>
        <div class="uix-center">
            <x:securityArea rolesAllowed="person.create">
                <p:commandButton process="@form" update="@form" action="#{personMB.save}" value="#{xmsg['save']}" />
            </x:securityArea>
            <x:securityArea rolesAllowed="person.audit">
                <x:audit for="#{personMB.entity}"/>
            </x:securityArea>
        </div>
    </h:form>

</ui:composition>